%数据

x=0.15:0.01:0.38;%腿长变化
y=[0.237661,0.240886,0.243926,0.247177,0.251411,0.254161,0.259460,0.263529,0.268014,0.272126,0.277184,0.281297,0.286477,0.291752,0.297297,0.302777,0.308570,0.313694,0.318776,0.323838,0.330012,0.336707,0.341745,0.348526];

%%机体质心到左右腿部质心的距离随腿长变化

%拟合
p=polyfit(x,y,3)
y_fit=polyval(p,x);
plot(x,y,'o');
hold on;
plot(x,y_fit,'_');
hold off;
legend('原始数据','拟合数据');
title('多项拟合式');
xlabel('x');
xlabel('y');

